Skip to main content

PostgreSQL Setup

Download & Install PostgreSQL

  • Download the PostgreSQL installer for Windows from the official website:
    https://www.postgresql.org/download/windows/

  • Run the installer and follow the setup wizard:

    • Choose an installation directory.
    • Set a password for the postgres superuser — remember this, you will need it.
    • Keep the default port 5432.
    • Select pgAdmin 4 (recommended) as a management tool during installation.

Start PostgreSQL Service

PostgreSQL runs as a Windows service automatically after installation.

To verify it is running:

  1. Open Services (Win + R → type services.msc).
  2. Find postgresql-x64-XX in the list.
  3. Status should show Running. If not, right-click → Start.

Create Database and User

Using pgAdmin 4

  1. Open pgAdmin 4 from the Start menu.
  2. Connect to the local server using the postgres superuser password set during installation.
  3. Right-click DatabasesCreateDatabase.
  4. Set Database name to whoxa and click Save.
  5. Right-click Login/Group RolesCreateLogin/Group Role.
  6. Set name to whoxa_user, go to Definition tab → set password, go to Privileges tab → enable Can login. Click Save.
  7. Right-click the whoxa database → PropertiesSecurity → grant all privileges to whoxa_user.

Using SQL Shell (psql)

Open SQL Shell (psql) from the Start menu and run:

CREATE DATABASE whoxa;
CREATE USER whoxa_user WITH PASSWORD 'your_strong_password';
GRANT ALL PRIVILEGES ON DATABASE whoxa TO whoxa_user;

Verify:

\l

Configure Environment Variables

In your backend .env file, set:

DB_HOST=localhost
DB_PORT=5432
DB_NAME=whoxa
DB_USER=whoxa_user
DB_PASSWORD=your_strong_password

Run Migrations

Once the database is created and environment variables are set:

cd whoxa-whatsapp-business-api
npx sequelize-cli db:migrate
npx sequelize-cli db:seed:all
tip

If you see a connection error, make sure the PostgreSQL service is running and the password in .env matches what you set during installation.